﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BattleshipContract;
using System.ServiceModel;
using System.Drawing;

namespace service
{
    [Serializable]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    class CGame : MarshalByRefObject, IGamePlay
    {
        //private List<Ship> shipList = new List<Ship>();
        private Player player1, player2;
        private bool winner;
        private List<Ship> Player1Ships = new List<Ship>();
        private List<Ship> Player2Ships = new List<Ship>();
        public delegate void PlayerReadyhandler(int PlayerId, Point[] positions);
        public delegate void PlayerTurnhandler(int PlayerId);
        public delegate void gameActionHandler();

#region Functions
        public void startGame(int playerId1, int playerId2)
        {
        
        }
        public void pauseGame()
        {
           
        }
        public void resumeGame()
        {
        
        }
        public void exitGame()
        { 
        
        }
        public void Shoot(int playerId, Point position)
        { 
        
        }
        public void Subscribe(eventTypes gameEvent,int PlayerId, Point[] positions)
        {


            /*IGameEvents subscriber = OperationContext.Current.GetCallbackChannel<IGameEvents>();
            PlayerReadyhandler playerReady = new PlayerReadyhandler(PlayerId, positions);
            if ((gameEvent && eventTypes.playerReady) == eventTypes.playerReady)
                playerReady += subscriber.onPlayerReady;*/
        }

        public void Unsubscribe(eventTypes gameEvent)
        {

        }
#endregion
        bool Winner
        {
            get { return winner; }
            set { winner = value; }
        }


        
    }
}
